home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / ontopocx / frmontop.frm (.txt) next >
Encoding:
Visual Basic Form  |  1998-11-22  |  2.9 KB  |  88 lines

  1. VERSION 5.00
  2. Object = "{F37391B5-821F-11D2-81A0-B4C03AE11570}#2.0#0"; "ONTOPOCX.OCX"
  3. Begin VB.Form frmOnTop 
  4.    Caption         =   "ForeGround Window Sample"
  5.    ClientHeight    =   1830
  6.    ClientLeft      =   165
  7.    ClientTop       =   735
  8.    ClientWidth     =   3780
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   1830
  11.    ScaleWidth      =   3780
  12.    StartUpPosition =   3  'Windows Default
  13.    Begin OnTop.OnTopOCX OnTopOCX1 
  14.       Left            =   150
  15.       Top             =   1200
  16.       _ExtentX        =   582
  17.       _ExtentY        =   582
  18.    End
  19.    Begin VB.CommandButton cmdQuit 
  20.       Caption         =   "Quit"
  21.       Height          =   465
  22.       Left            =   900
  23.       TabIndex        =   1
  24.       Top             =   1200
  25.       Width           =   1965
  26.    End
  27.    Begin VB.CheckBox chkTopMost 
  28.       Caption         =   "Keep window on top"
  29.       Height          =   465
  30.       Left            =   900
  31.       TabIndex        =   0
  32.       Top             =   300
  33.       Width           =   1965
  34.    End
  35.    Begin VB.Menu mnuOptions 
  36.       Caption         =   "Options"
  37.       Begin VB.Menu mnuTopMost 
  38.          Caption         =   "Keep Window on top"
  39.       End
  40.    End
  41. Attribute VB_Name = "frmOnTop"
  42. Attribute VB_GlobalNameSpace = False
  43. Attribute VB_Creatable = False
  44. Attribute VB_PredeclaredId = True
  45. Attribute VB_Exposed = False
  46. ' -------------------------------------------------------------
  47. '               Copyright 
  48.  1998 CMeProducts
  49. '   This example of the OnTopOCX shows how simple it is to
  50. '   put any window in the foreground, forcing it to stay on
  51. '   top of any window.
  52. '   The syntax for use is:
  53. '       OnTopOCX1.ForeGround(form-name)=True (or False)
  54. '       'form-name' is the name of the form you wish to
  55. '       set to the foreground.
  56. ' -------------------------------------------------------------
  57. Option Explicit
  58. Private Sub chkTopMost_Click()
  59.     'Set window to foreground depending on user choice
  60.     If chkTopMost.Value = 1 Then
  61.         OnTopOCX1.ForeGround(Me) = True 'Set topmost
  62.         mnuTopMost.Checked = True 'Put check mark on option menu
  63.     Else
  64.         OnTopOCX1.ForeGround(Me) = False 'Set normal
  65.         mnuTopMost.Checked = False 'Remove check mark from menu
  66.     End If
  67. End Sub
  68. Private Sub cmdQuit_Click()
  69.     ' Close program
  70.     Unload Me
  71. End Sub
  72. Private Sub Form_Load()
  73.     ' Set Form to startup centre screen
  74.     Me.Left = (Screen.Width - Me.Width) / 2
  75.     Me.Top = (Screen.Height - Me.Height) / 2
  76. End Sub
  77. Private Sub mnuTopMost_Click()
  78.     'Place or remove check mark from menu
  79.     mnuTopMost.Checked = Not mnuTopMost.Checked
  80.     If mnuTopMost.Checked = True Then
  81.         OnTopOCX1.ForeGround(Me) = True 'Set topmost
  82.         chkTopMost.Value = 1 'Put check mark in check box
  83.     Else
  84.         OnTopOCX1.ForeGround(Me) = False 'Set normal
  85.         chkTopMost.Value = 0 'Remove check mark from check box
  86.     End If
  87. End Sub
  88.